package cn.pn.project.client.commodity;

import cn.pn.project.client.commodity.follback.SkuFeignFallback;
import cn.pn.project.pojo.commodity.Sku;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;;

import java.sql.SQLException;
import java.util.List;

@FeignClient(name="pn-item-provider",fallback = SkuFeignFallback.class)
public interface SkuFeign {

    /**
     * 根据商品id查询场次id
     * @param commdityId
     * @return--------
     * @throws SQLException
     */
    @RequestMapping(value = "/getSkuByCommdityId",method = RequestMethod.POST)
    public List<Sku> getSkuByCommdityId(@RequestParam("commdityId")Integer commdityId) throws SQLException;

    /**
     * 根据场次id和商品id查询skuid
     * @param commdityId 商品id
     * @param sessionId 场次id
     * @return
     * @throws SQLException
     */
    @RequestMapping(value = "/getSkuByCommdityIdAndSessionId",method = RequestMethod.POST)
    public List<Sku> getSkuByCommdityIdAndSessionId(@RequestParam(value = "commdityId",required = false)Integer commdityId, @RequestParam("sessionId") Integer sessionId) throws SQLException;

    @RequestMapping(value = "/getPrice",method = RequestMethod.POST)
    public Sku getPrice(@RequestParam("commdityId") Integer commdityId,@RequestParam("sessionId") Integer sessionId,@RequestParam("ticketFileId") Integer ticketFileId) throws  SQLException;
}
